<?php
    require ( 'init.inc.php' );
    require ( 'checkadmin.inc.php');
    require ( __COMM_PATH . 'pagecontrol.inc.php' );
    require ( __CLASS_PATH . 'page_list.class.php' );

    // -------------------------------------------------------
    // 接收传递过来的变量
    // -------------------------------------------------------
    $action = $_REQUEST["action"];
    $id = addslashes($_REQUEST["id"]);

    // -------------------------------------------------------
    // 批量操作
    // -------------------------------------------------------
    if (!empty($id)) {
        switch ($action) {
            case "del" : $db->query("delete from `{$tablepre}jobs` where id in ({$id})"); break;
            case "confirm" : $db->query("update`{$tablepre}jobs` set `status`=1 where id in ({$id})"); break;
            case "deconfirm" : $db->query("update`{$tablepre}jobs` set `status`=0 where id in ({$id})"); break;
        }
    }

    // -------------------------------------------------------
    // 页面基本设置
    // -------------------------------------------------------
    $page_title   = $ptitle["job_list"];
    $page_size    = 15;
    $display_page = "job_list.htm";
    $keyword      = addslashes(substr($_REQUEST["keyword"], 0, 150));
    $sortby       = "posttime";
    $oexp         = "desc";
    $search_arr   = array (
						array("field" => "jobs", "keyword" => urldecode($keyword), "condition" => "like", "junk" => "or"),
                        array("field" => "place", "keyword" => urldecode($keyword), "condition" => "like", "junk" => "or"),
                    );
	$search_junk  = "and";
    $query_sql    = "select * from `{$tablepre}jobs` where `id`<>0";
    $url_para_arr = array ('keyword');
    $tpl->assign("jobs_search", $ptitle["jobs_search"]);
	
    // -------------------------------------------------------
    // 执行页面处理
    // -------------------------------------------------------
    show_page_head("list",$page_title);
    $plist = new PageList($page_title, $page_size);
    $plist->SetSearch($search_arr, $search_junk);
    $plist->SortOpen = true;
    $plist->SetSort($sortby, $oexp);
    $plist->SetUrlParam($url_para_arr);
    $plist->Execute($query_sql);
    $plist->TplParse($display_page);
    show_page_foot();
    $db->close();
?>